<template>
  <el-table
     :data="reset"
     border
    @selection-change="handleSelectionChange"
    style="width: 100%"
    :header-cell-style="{background:'#f4f4f4'}">
    <el-table-column 
      fixed 
      align="center"
      type="selection"
      width="45">
    </el-table-column>
    <!-- <el-table-column
      prop="WorkstationId"
      align="center"
      width="65"
      label="工位ID">
    </el-table-column> -->
    <el-table-column
      type="index"
      :index="indexMethod"
      align="center"
      width="65"
      label="序号">
    </el-table-column>
    <el-table-column
      prop="Name"
      align="center"
      :show-overflow-tooltip="true"
      label="工位简称">
    </el-table-column>
    <el-table-column
      prop="Description"
      align="center"
      :show-overflow-tooltip="true"
      label="工位描述">
    </el-table-column>
    <el-table-column
      prop=".."
      width="140"
      align="center"
      label="电脑MAC地址">
    </el-table-column>
    <el-table-column
      prop="IPAddress"
      :show-overflow-tooltip="true" 
      align="center"
      label="IP地址">
    </el-table-column>
    <el-table-column
      prop="TechName"
      align="center"
      :show-overflow-tooltip="true" 
      label="所属工序">
    </el-table-column>
    <el-table-column
      prop="LineName"
      align="center"
      :show-overflow-tooltip="true" 
      label="线体名称">
    </el-table-column>
    <el-table-column
      prop="CreateBy"
      align="center"
      width="70"
      label="机器ID">
    </el-table-column>
    <el-table-column
      prop="shengchancang"
      align="center"
      :show-overflow-tooltip="true" 
      label="生产仓">
    </el-table-column>
    <el-table-column
      prop="StationType"
      align="center"
      :formatter="format" 
      :show-overflow-tooltip="true"
      width="60" 
      label="类型">
    </el-table-column>
    <el-table-column
      prop="IsEnable"
      align="center"
      :formatter="format1" 
      width="60" 
      label="状态">
    </el-table-column>
    <el-table-column
      prop="CreateByFormat"
      :show-overflow-tooltip="true" 
      align="center"
      label="创建人">
    </el-table-column>
    <el-table-column
      prop="CreateTime"
      :show-overflow-tooltip="true" 
      align="center"
      label="创建时间">
    </el-table-column>
    <el-table-column
      prop="LastModifyByFormat"
      :show-overflow-tooltip="true" 
      align="center"
      label="修改人">
    </el-table-column>
    <el-table-column
      prop="LastModifyTime"
      align="center"
      :show-overflow-tooltip="true" 
      label="修改时间">
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  props: {
    reset: {
      type: Array
    }
  },
  data() {
    return {
      
    }
  },
  methods:{
    handleSelectionChange(val){
      this.$emit('changeData',val)
      let listId=[]
      val.forEach(el => {
          listId.push(el.WorkstationId)
      });
      this.$emit('getId',listId) 
    },
    
    format(row, column, cellValue, index){
      if(row.StationType==1){
        return '私有'
      }else{
        return '公共'
      }   
    },
    format1(row, column, cellValue, index){
      if(row.IsEnable==1){
        return '启用'
      }else{
        return '禁用'
      }   
    },
    indexMethod(index){
      return (index+1)+(this.$parent.currentPage-1)*this.$parent.size
    },
  }
}
</script>